package com.tomshushu.doc.freedoc.modular.version.controller;

import com.tomshushu.doc.freedoc.core.model.response.ResponseData;
import com.tomshushu.doc.freedoc.core.model.response.SuccessResponseData;
import com.tomshushu.doc.freedoc.modular.version.param.AddVersionParam;
import com.tomshushu.doc.freedoc.modular.version.param.PageVersionParam;
import com.tomshushu.doc.freedoc.modular.version.param.RebackVersionParam;
import com.tomshushu.doc.freedoc.modular.version.service.VersionService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: zhouhong
 * @date: 2025-06-10 17:26
 * @version: 1.0
 */
@RestController
@RequestMapping("/doc/version")
public class VersionController {

    @Resource
    private VersionService versionService;

    @PostMapping("/addVersion")
    public ResponseData addTmp(@RequestBody AddVersionParam param) {
        versionService.addVersion(param);
        return new SuccessResponseData();
    }

    @PostMapping("/rebackVersion")
    public ResponseData rebackVersion(@RequestBody RebackVersionParam param) {
        versionService.rebackVersion(param);
        return new SuccessResponseData();
    }

    @PostMapping("/pageVersion")
    public ResponseData pageVersion(@RequestBody PageVersionParam param) {
        return new SuccessResponseData(versionService.pageVersion(param));
    }
}
